// When color definition differs for dark and light variant,
// it gets @if ed depending on $variant

@import 'color-palette';

@function fade($c) {
  @return mix($c, $grey_900, 50%);
}

// Foreground colors
$dark_fg_color:   rgba($black, 0.87);
$light_fg_color:  $white;
$button_fg_color: if($variant == 'light', rgba($black, 0.62), rgba($white, 0.8)); // extra fg color for raised buttons

$fg_color:                    if($variant == 'light', rgba($black, 0.87), $white);
$secondary_fg_color:          if($variant == 'light', rgba($black, 0.54), rgba($white, 0.7));
$hint_fg_color:               if($variant == 'light', rgba($black, 0.38), rgba($white, 0.5));
$disabled_fg_color:           if($variant == 'light', rgba($black, 0.38), rgba($white, 0.35));
$disabled_secondary_fg_color: if($variant == 'light', rgba($black, 0.26), rgba($white, 0.25));
$track_color:                 if($variant == 'light', rgba($black, 0.26), rgba($white, 0.25));
$divider_color:               if($variant == 'light', rgba($black, 0.12), rgba($white, 0.12));

$titlebar_fg_color:                    if($panel == 'light', rgba($black, 0.87), $white);
$titlebar_secondary_fg_color:          if($panel == 'light', rgba($black, 0.54), rgba($white, 0.7));
$titlebar_hint_fg_color:               if($panel == 'light', rgba($black, 0.38), rgba($white, 0.5));
$titlebar_disabled_fg_color:           if($panel == 'light', rgba($black, 0.38), rgba($white, 0.5));
$titlebar_disabled_secondary_fg_color: if($panel == 'light', rgba($black, 0.26), rgba($white, 0.3));
$titlebar_track_color:                 if($panel == 'light', rgba($black, 0.26), rgba($white, 0.3));
$titlebar_divider_color:               if($panel == 'light', rgba($black, 0.12), rgba($white, 0.12));

$inverse_fg_color:                    $white;
$inverse_secondary_fg_color:          rgba($white, 0.7);
$inverse_hint_fg_color:               rgba($white, 0.5);
$inverse_disabled_fg_color:           rgba($white, 0.5);
$inverse_disabled_secondary_fg_color: rgba($white, 0.3);
$inverse_track_color:                 rgba($white, 0.3);
$inverse_divider_color:               rgba($white, 0.12);

// Background colors
$base_color:     if($variant =='dark', if($color =='doder' or $color =='beryl', #2c2e33, #282828), #ffffff);
$alt_base_color: if($variant =='dark', darken($base_color, 3%), darken($base_color, 6%));

$bg_color:         rgba($black, $middle_opacity);
$alt_bg_color:     rgba($black, $lower_opacity);
$inverse_bg_color: rgba($inverse_fg_color, 0.1);

$panel_bg_color: rgba(black, 0.45);
@if ($color == 'ruby' or $color == 'black') and $panel =='dark' { $panel_bg_color: #282828; }
@if ($color == 'doder' or $color == 'beryl') and $panel =='dark' { $panel_bg_color: #27282d; }

$keyboard_bg_color:  if($variant == 'light', $grey_50, fade($grey_600));
$alt_keyboard_bg_color:  if($variant == 'light', $grey_300, fade($grey_900));

// Misc colors

$primary_color: #555555;
$alt_primary_color: #666666;
$accent_color: #444444;

@if $color == 'ruby' { $primary_color: #F0544C; $alt_primary_color: #FF615A; $accent_color: #FF626C; }
@if $color == 'doder' { $primary_color: #4586D8; $alt_primary_color: #03a9f4; $accent_color: #0CAAF0; }
@if $color == 'beryl' { $primary_color: #2EB398; $alt_primary_color: #1eba9b; $accent_color: #0fd1ab; }
@if $color == 'black' { $primary_color: #555555; $alt_primary_color: #666666; $accent_color: #EEEEEE; }

$theme_color: if($color == 'black' or $color == 'white', $inverse_fg_color, $primary_color);

$theme_primary_color: $theme_color;

@if ($color == 'black' or $color == 'white') and $variant == 'light' {
  $theme_primary_color: $primary_color;
}

$link_color:         $primary_color;
$visited_link_color: $purple_A200;

$warning_color: $orange_A700;
$error_color:   $deep_orange_A700;
$success_color: $green_A700;

$suggested_color:   if($color == 'black', #424242, $accent_color);
$destructive_color: $red_A200;

$info_bg_color:     $green_400;
$question_bg_color: $blue_400;
$warning_bg_color:  $orange_400;
$error_bg_color:    $red_400;

$border_color:        if($variant == 'light', rgba($black, 0.12), rgba($black, 0.26));
$highlight_color:     if($variant == 'light', rgba($white, 0.4),  rgba($white, 0.1));
$alt_highlight_color: rgba($white, 0.2);
